﻿using System;
using System.Collections.Generic;
using ContractManager.Entity.Base;
using Speed.Data;

namespace ContractManager.BLL.Business
{
    public static class ClsReportAnalysis
    {
        public static List<ReportAnalysis> SelectAll()
        {
            using (var db = Sys.NewDb())
            {
                return Data.Base.ReportAnalysis.Select(db);
            }
            
        }

        public static void Insert(ReportAnalysis capital)
        {
            using (var db = Sys.NewDb())
            {
                db.BeginTransaction();
                db.Insert<ReportAnalysis>(capital, EnumSaveMode.Requery);
               
                db.Commit();
            }
        }

        public static void Update(ReportAnalysis capital)
        {
            using (var db = Sys.NewDb())
            {
                db.BeginTransaction();
                db.Update<ReportAnalysis>(capital);
                db.Commit();
            }
            
        }

        public static ReportAnalysis SelectByPk(Int32 reportId)
        {
            using (var db = Sys.NewDb())
            {
                return db.SelectSingle<ReportAnalysis>(string.Format("ReportId={0}", reportId));
            }
            
        }

        public static int DeleteByPk(Int32 reportId)
        {
            using (var db = Sys.NewDb())
            {
                return db.Delete<ReportAnalysis>(string.Format("ReportId={0}", reportId));
            }
            
        }


        
    }
}
